package com.ftg.learn.chapter04.view;

import com.ftg.learn.chapter04.domain.BedRoom;
import com.ftg.learn.chapter04.domain.Human;
import com.ftg.learn.chapter04.service.BedRoomService;

/**
 * 要有一个为多人一键分配寝室
 *
 * @author 布衣
 */
public class Admin {

    public static void main(String[] args) {
        BedRoomService bs = new BedRoomService();
        Human h1 = new Human("王春花");
        Human h2 = new Human("李少芬");
        Human h3 = new Human("何花");
        Human h4 = new Human("坤姐");
        Human h5 = new Human("张小花");
        Human h6 = new Human("张2花");
        Human h7 = new Human("张3花");
        Human h8 = new Human("张4花");
        Human h9 = new Human("张5花");
        Human h10 = new Human("张6花");
        Human h11 = new Human("张7花");
        Human h12 = new Human("张8花");
        Human h13 = new Human("张9花");

        //给我十个人名


        //给我两个Human实例 并赋值给一个数组
        Human[] hs = {h1, h2, h3, h4, h5, h6, h7, h8, h9, h10, h11, h12, h13};

        bs.shareBedRoom("1001", "第八公寓", h1, h2);


//        bs.saveBedRoom("1001", "第八公寓", 4, 4);
        bs.saveBedRoom("1002", "第八公寓", 4, 4);
        bs.saveBedRoom("1003", "第八公寓", 4, 4);
        bs.saveBedRoom("1004", "第八公寓", 4, 4);
        bs.saveBedRoom("1005", "第八公寓", 4, 4);
        bs.saveBedRoom("1006", "第八公寓", 4, 4);
        bs.saveBedRoom("1007", "第八公寓", 4, 4);
        bs.saveBedRoom("1008", "第八公寓", 4, 4);

        bs.autoSharBedRoom(h3, h4, h5, h6, h7, h8, h9, h10, h11, h12, h13);


        //手动分配寝室
//        bs.shareBedRoom("1001", "第八公寓", h1, h2, h3, h4);

        BedRoom[] allBedRoom = bs.getAllBedRoom();
        for (BedRoom bedRoom : allBedRoom) {
            System.out.printf("寝室名称%s\t", bedRoom.getDoorNum());
            System.out.printf("寝室地址%s\t", bedRoom.getAddress());
            System.out.println("入住的人员信息");
            Human[] allHumans = bedRoom.getAllHumans();
            for (Human allHuman : allHumans) {
                System.out.printf("姓名叫%s\t", allHuman.getName());
            }
            System.out.println();
        }

    }

}
